﻿using System;
using System.Collections.Generic;
using System.Web.Routing;
using Nop.Core.Domain.Shipping;
using Nop.Core.Plugins;
using Nop.Plugin.Remote.Vishnu.Data;
using Nop.Plugin.Remote.Vishnu.Domain;
using Nop.Plugin.Remote.Vishnu.Services;
using Nop.Services.Catalog;
using Nop.Services.Configuration;
using Nop.Services.Localization;
using Nop.Services.Shipping;

namespace Nop.Plugin.Remote.Vishnu
{
    public class VishnuPlugin : BasePlugin, IAutoStart
    {
        #region Fields

        private readonly ISettingService _settingService;
        private readonly VishnuSettings _vishnuSettings;
        private readonly VishnuObjectContext _objectContext;

        #endregion

        #region Ctor
        public VishnuPlugin(ISettingService settingService,
            VishnuSettings vishnuSettings,
            VishnuObjectContext objectContext)
        {
            this._settingService = settingService;
            this._vishnuSettings = vishnuSettings;
            this._objectContext = objectContext;
        }
        #endregion


        #region Methods


        /// <summary>
        /// Install plugin
        /// </summary>
        public override void Install()
        {
            _objectContext.Install();

            var settings = new VishnuSettings()
            {
                SSLMandatory = true,
                HtmlColor = "#F8FF8F"
            };

            _settingService.SaveSetting(settings);

            base.Install();
        }

        /// <summary>
        /// Uninstall plugin
        /// </summary>
        public override void Uninstall()
        {
            _objectContext.Uninstall();
            base.Uninstall();
        }
        #endregion

        #region Properties


        #endregion

        #region IAutoStart Membres

        public void Start()
        {

        }

        public void Stop()
        {
        }

        #endregion
    }
}
